import style from './style/sidebar.scss';
export default class Item extends React.Component{
	constructor(){
		super();
		this.state = {isOpen:false}
	}
	show(){
		this.setState({
			isOpen:true
		})
	}
	hide(){
		this.setState({
			isOpen:false
		})
	}
	render(){
		return (
			<div className={cn({
				[style.item]:true,
				[style.open]:this.state.isOpen
			})}
			onMouseOver={::this.show}
			onMouseLeave={::this.hide}
			>
				<a href="#">
					<span className={style.icon}><i className={this.props.icon}></i></span>
					<div className={style["item-content"]}>
						{this.props.children}
					</div>
					<div className="clearfix"></div>
					</a>
			</div>
		)
	}
}